package com.shh.aiojbackendserver.context;

import com.shh.aiojbackendserver.model.entity.User;

/**
 * 上下文基类 跨方法调用且无法修改参数传递。
 * @author 嗜好
 */
public class UserContext {
    public static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static void setUser(User user) {
        threadLocal.set(user);
    }

    public static User getUser() {
        return threadLocal.get();
    }

    public static void removeUser() {
        threadLocal.remove();
    }
}
